<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="Shortcut Icon" href="../images/aecc.ico" type="image/x-icon" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="../StaticFiles/element-ui/element-ui.css">
  <link rel="stylesheet" href="../StaticFiles/nprogress/nprogress.min.css">
  <link rel="stylesheet" href="../styles/vue-page-common.css">
  <script src="../Scripts/vue.min.js"></script>
  <script src="../StaticFiles/element-ui/element-ui.js"></script>
  <script src="../Scripts/axios.min.js"></script>
  <script src="../Scripts/crypto-js.js"></script>
  <script src="../Scripts/secret.js"></script>
  <script src="../StaticFiles/nprogress/nprogress.min.js"></script>
  <script src="../Scripts/dayjs.min.js"></script>
  <script src="../Scripts/axios.config.js"></script>
  <title>生产计划报表</title>
</head>

<body>
  <div id="app" v-cloak v-on:keyup.enter="getData">
    <!-- 报表标题 -->
    <vue2-report-header :title="queryInfo.factoryname+'生产计划报表'"></vue2-report-header>
    <div style="padding: 10px;">
      <!-- 查询条件 -->
      <el-form :inline="true" :model="queryInfo" id="queryZone" ref="queryInfoRef" :label-position="'left'"
        :rules="rules">
        <el-form-item label="筛选时间:" prop="selectdate">
          <el-date-picker v-model="queryInfo.selectdate" type="daterange" range-separator="至" value-format="yyyy-MM-dd"
            start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions"></el-date-picker>
        </el-form-item>

        <el-form-item label="主制工区:">
          <el-select v-model="queryInfo.workcenterid" placeholder="请选择" clearable filterable>
            <el-option v-for="item in workcenterList" :key="item.workcenterid" :label="item.workcentername"
              :value="item.workcenterid">
            </el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="订单类型:">
          <el-select v-model="queryInfo.ordertype" placeholder="请选择" clearable filterable style="width: 100px;">
            <el-option :key="'临时'" :label="'临时'" :value="'临时'"></el-option>
            <el-option :key="'品种'" :label="'品种'" :value="'品种'"></el-option>
            <el-option :key="'预品种'" :label="'预品种'" :value="'预品种'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="计划类型:">
          <el-select v-model="queryInfo.plantype" placeholder="请选择" clearable filterable style="width: 100px;">
            <el-option :key="'初制'" :label="'初制'" :value="'初制'"></el-option>
            <el-option :key="'复制'" :label="'复制'" :value="'复制'"></el-option>
            <el-option :key="'修理'" :label="'修理'" :value="'修理'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="是否超期:">
          <el-select v-model="queryInfo.isdelay" placeholder="请选择" clearable filterable style="width: 100px;">
            <el-option :key="'是'" :label="'是'" :value="'是'"></el-option>
            <el-option :key="'否'" :label="'否'" :value="'否'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="是否跳序:">
          <el-select v-model="queryInfo.isskip" placeholder="请选择" clearable filterable style="width: 100px;">
            <el-option :key="'是'" :label="'是'" :value="'是'"></el-option>
            <el-option :key="'否'" :label="'否'" :value="'否'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="完工状态:">
          <el-select v-model="queryInfo.status" placeholder="请选择" clearable filterable style="width: 140px;">
            <el-option :key="'完工入库'" :label="'完工入库'" :value="'完工入库'"></el-option>
            <el-option :key="'待检验'" :label="'待检验'" :value="'待检验'"></el-option>
            <el-option :key="'待报工'" :label="'待报工'" :value="'待报工'"></el-option>
            <el-option :key="'待派工'" :label="'待派工'" :value="'待派工'"></el-option>
          </el-select>
        </el-form-item>

        <el-form-item prop='productname' label="零件图号:">
          <el-autocomplete v-model.trim="queryInfo.productname" placeholder="请输入零件图号" :trigger-on-focus="false"
            style="width:240px;" :fetch-suggestions="searchProductAsync" :value-key="'productname'" :debounce="500">
          </el-autocomplete>
        </el-form-item>

        <el-form-item label="重要程度:">
          <el-input v-model.trim="queryInfo.priority" placeholder="请输入" clearable style="width: 120px;"></el-input>
        </el-form-item>

        <el-form-item label="风险等级:">
          <el-input v-model.trim="queryInfo.risklevel" placeholder="请输入" clearable style="width: 120px;"></el-input>
        </el-form-item>

        <el-form-item label="工时完成率:">
          <el-slider v-model="queryInfo.worktimerate" range :max="100" :step="5" style="width: 120px;">
          </el-slider>
        </el-form-item>

        <el-form-item>
          <el-input v-model="worktimeratelable" style="width: 110px;" :disabled="true"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="small" @click="getData">查 询</el-button>
          <el-button type="primary" icon="el-icon-download" size="small" @click="exportDetail">导 出</el-button>
        </el-form-item>
      </el-form>

      <!-- 主表格 -->
      <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
        element-loading-background="rgba(0,0,0,0.8)" :data="dataList" stripe border>
        <el-table-column type="index" width="50"></el-table-column>
        <el-table-column label="操作" width="80">
          <template slot-scope="scope">
            <el-link type="primary" @click='showChildContainer(scope.row)'>查看明细</el-link>
          </template>
        </el-table-column>
        <el-table-column label="零件号" prop="productname" width="120" show-overflow-tooltip></el-table-column>
        <el-table-column label="零件/批次号" prop="containername" show-overflow-tooltip>
        </el-table-column>
        <el-table-column label="是否入库" prop="isinstore" width="55" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" :type="scope.row.isinstore === '是' ? 'success' : 'danger'">
              {{scope.row.isinstore}}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="主制工区" prop="workcentername" width="140" show-overflow-tooltip style="font-size: 10px;">
        </el-table-column>
        <el-table-column label="当前工序" prop="currentspec" width="100" show-overflow-tooltip></el-table-column>
        <el-table-column label="状态" prop="status" width="95" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" v-if="scope.row.status === '完工入库'" type="success">完工入库</el-tag>
            <el-tag effect="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
            <el-tag effect="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
            <el-tag effect="dark" v-else type="info">待派工</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="开始时间" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
        <el-table-column label="结束时间" prop="enddate" width="100" :formatter="splitDate"></el-table-column>
        <el-table-column label="是否超期" prop="delaystatus" width="80" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" :type="scope.row.delaystatus === '否'?'success':'danger'">
              {{scope.row.delaystatus}}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="品种类型" prop="ordertype" width="55" show-overflow-tooltip></el-table-column>
        <el-table-column label="计划类型" prop="plantype" width="55" show-overflow-tooltip></el-table-column>
        <el-table-column label="总工时" prop="totalworktime" width="70" show-overflow-tooltip></el-table-column>
        <el-table-column label="已完工工时" prop="finishedworktime" width="65" show-overflow-tooltip>
        </el-table-column>
        <el-table-column label="工时完成率" prop="worktimerate" width="100" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-progress :percentage='scope.row.worktimerate' :stroke-width="8" :color="'#67c23a'">
            </el-progress>
          </template>
        </el-table-column>
        <el-table-column label="子零件完成数" prop="finishinfo" width="60" show-overflow-tooltip>
          <template slot-scope="scope">
            <div>
              <el-link type="danger" v-if="scope.row.finishinfo.split('/')[0] !== scope.row.finishinfo.split('/')[1]"
                @click="getNotFinishedChildContainer(scope.row)">
                {{scope.row.finishinfo}}
              </el-link>
              <span v-else style="color:#67c23a">{{scope.row.finishinfo}}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="材料是否齐套" prop="isallset" width="60" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" :type="scope.row.isallset === '是'?'success':'danger'">
              {{scope.row.isallset}}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="材料缺件情况" prop="lackqty" width="60" show-overflow-tooltip>
          <template slot-scope="scope">
            <div>
              <el-link v-if="scope.row.lackqty > 0" type="danger" @click="getMissingPart(scope.row)">
                缺{{scope.row.lackqty}} 件
              </el-link>
              <span v-else style="color:#67c23a">0</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="是否存在跳序" prop="isskip" width="60" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" v-if="scope.row.isskip === '否'" type="success">{{scope.row.isskip}}</el-tag>
            <el-tag effect="dark" v-else type="danger" style="cursor:pointer;" @click="getSkipStepInfo(scope.row)">
              {{scope.row.isskip}}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="重要等级" prop="priority" width="80" show-overflow-tooltip></el-table-column>
        <el-table-column label="风险程度" prop="risklevel" width="80" show-overflow-tooltip></el-table-column>
      </el-table>

      <!-- 分页组件 -->
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
        :current-page="queryInfo.currentPage" :page-sizes="[12,20,50,100]" :page-size="12"
        layout="prev,pager,next,jumper,sizes,total" :total="total">
      </el-pagination>

      <!-- 回到顶部 -->
      <el-backtop></el-backtop>
    </div>

    <!-- 子零件批次 -->
    <el-dialog :title="childContainerDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
      :visible.sync="childContainerDetail.dialogVisiable">
      <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
        element-loading-background="rgba(0,0,0,0.8)" :data="childContainerDetail.dataList" stripe border>
        <el-table-column type="index" width="50"></el-table-column>
        <el-table-column label="操作" width="100">
          <template slot-scope="scope">
            <el-link type="primary" @click='showChildContainerSpec(scope.row)'>查看各工序</el-link>
          </template>
        </el-table-column>
        <el-table-column label="零件号" prop="productname" width="100" show-overflow-tooltip></el-table-column>
        <el-table-column label="零件/批次号" prop="containername" show-overflow-tooltip>
        </el-table-column>
        <el-table-column label="是否入库" prop="isinstore" width="56" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" :type="scope.row.isinstore === '是' ? 'success' : 'danger'">
              {{scope.row.isinstore}}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="主制工区" prop="workcentername" width="140" show-overflow-tooltip style="font-size: 10px;">
        </el-table-column>
        <el-table-column label="当前工序" prop="currentspec" width="100" show-overflow-tooltip></el-table-column>
        <el-table-column label="状态" prop="status" width="95" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" v-if="scope.row.status === '完工入库'" type="success">完工入库</el-tag>
            <el-tag effect="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
            <el-tag effect="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
            <el-tag effect="dark" v-else type="info">待派工</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="开始时间" prop="startdate" width="100" :formatter="splitDate"></el-table-column>
        <el-table-column label="结束时间" prop="enddate" width="100" :formatter="splitDate"></el-table-column>
        <el-table-column label="是否超期" prop="delaystatus" width="80" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" :type="scope.row.delaystatus === '否'?'success':'danger'">
              {{scope.row.delaystatus}}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="品种类型" prop="ordertype" width="60" show-overflow-tooltip></el-table-column>
        <el-table-column label="计划类型" prop="plantype" width="60" show-overflow-tooltip></el-table-column>
        <el-table-column label="总工时" prop="totalworktime" width="70" show-overflow-tooltip></el-table-column>
        <el-table-column label="已完工工时" prop="finishedworktime" width="65" show-overflow-tooltip>
        </el-table-column>
        <el-table-column label="工时完成率" prop="worktimerate" width="100" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-progress :percentage='scope.row.worktimerate' :stroke-width="8" :color="'#67c23a'">
            </el-progress>
          </template>
        </el-table-column>
        <el-table-column label="材料是否齐套" prop="isallset" width="60" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" :type="scope.row.isallset === '是'?'success':'danger'">
              {{scope.row.isallset}}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column label="是否存在跳序" prop="isskip" width="60" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" v-if="scope.row.isskip === '否'" type="success">{{scope.row.isskip}}</el-tag>
            <el-tag effect="dark" v-else type="danger" style="cursor:pointer;"
              @click="getChildContainerSkipInfo(scope.row)">
              {{scope.row.isskip}}</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="重要等级" prop="priority" width="80" show-overflow-tooltip></el-table-column>
        <el-table-column label="风险程度" prop="risklevel" width="80" show-overflow-tooltip></el-table-column>
      </el-table>
    </el-dialog>

    <!-- 子零件批次工序 -->
    <el-dialog :title="childContainerSpecDetail.title" :width="'98%'" :top="'10px'" :center="'center'"
      :visible.sync="childContainerSpecDetail.dialogVisiable">
      <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
        element-loading-background="rgba(0,0,0,0.8)" :data="childContainerSpecDetail.dataList" stripe border>
        <el-table-column type="index" width="50"></el-table-column>
        <el-table-column label="批次号" prop="containername" width="200" show-overflow-tooltip></el-table-column>
        <el-table-column label="批次数量" prop="qty" width="100" show-overflow-tooltip></el-table-column>
        <el-table-column label="工序" prop="workflowstepname" width="200" show-overflow-tooltip></el-table-column>
        <el-table-column label="单位工时" prop="durationperunit" width="100" show-overflow-tooltip></el-table-column>
        <el-table-column label="派工人" prop="dispatchemployeename" width="100" show-overflow-tooltip></el-table-column>
        <el-table-column label="派工时间" prop="dispatchdate" width="100" :formatter="splitDate"></el-table-column>
        <el-table-column label="报工人" prop="reportemployeename" width="100" show-overflow-tooltip></el-table-column>
        <el-table-column label="报工时间" prop="reportdate" width="100" :formatter="splitDate"></el-table-column>
        <el-table-column label="检验人" prop="checkemployeename" width="100" show-overflow-tooltip></el-table-column>
        <el-table-column label="检验时间" prop="checkdate" width="100" :formatter="splitDate"></el-table-column>
        <el-table-column label="状态" prop="status" width="100" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effec="dark" v-if="scope.row.status === '已完工'" type="success">已完工</el-tag>
            <el-tag effec="dark" v-else-if="scope.row.status === '待检验'" type="danger">待检验</el-tag>
            <el-tag effec="dark" v-else-if="scope.row.status === '待报工'">待报工</el-tag>
            <el-tag effec="dark" v-else type="info">待派工</el-tag>
          </template>
        </el-table-column>
        <el-table-column label="是否外委" prop="isww" width="100" show-overflow-tooltip>
          <template slot-scope="scope" v-if="scope.row.isww">
            <el-tag effect="dark" v-if="scope.row.isww === '是'" type="danger">是</el-tag>
            <el-tag effect="dark" v-else>否</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>

    <!-- 缺件明细 -->
    <el-dialog :title="missingPartDetail.title" :width="'50%'" :center="'center'"
      :visible.sync="missingPartDetail.dialogVisiable">
      <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
        element-loading-background="rgba(0,0,0,0.8)" :data="missingPartDetail.dataList" stripe border>
        <el-table-column type="index" width="50"></el-table-column>
        <el-table-column label="零件号" prop="productname" width="200" show-overflow-tooltip></el-table-column>
        <el-table-column label="零件名称" prop="productdescription" width="200" show-overflow-tooltip></el-table-column>
        <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
        <el-table-column label="数量" prop="qty" width="60" show-overflow-tooltip></el-table-column>
        <el-table-column label="是否缺件" prop="isallset" width="80" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" type="danger">是</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>

    <!-- 未完成子零件信息 -->
    <el-dialog :title="notFinishedChildContainerDetail.title" :width="'50%'" :center="'center'"
      :visible.sync="notFinishedChildContainerDetail.dialogVisiable">
      <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
        element-loading-background="rgba(0,0,0,0.8)" :data="notFinishedChildContainerDetail.dataList" stripe border>
        <el-table-column type="index" width="50"></el-table-column>
        <el-table-column label="零件号" prop="productname" width="200" show-overflow-tooltip></el-table-column>
        <el-table-column label="零件名称" prop="productdescription" width="200" show-overflow-tooltip></el-table-column>
        <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
        <el-table-column label="数量" prop="qty" width="60" show-overflow-tooltip></el-table-column>
        <el-table-column label="是否完成" prop="isallset" width="80" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag effect="dark" type="danger">否</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>

    <!-- 跳序信息 -->
    <el-dialog :title="skipStepDetail.title" :width="'50%'" :top="'10px'" :center="'center'"
      :visible.sync="skipStepDetail.dialogVisiable">
      <el-table v-loading="loading" v-loading.fullscreen.lock="loading" :element-loading-text="loadingText"
        element-loading-background="rgba(0,0,0,0.8)" :data="skipStepDetail.dataList" stripe border>
        <el-table-column type="index" width="50"></el-table-column>
        <el-table-column label="批次号" prop="containername" show-overflow-tooltip></el-table-column>
        <el-table-column label="工序名称" prop="workflowstepname" width="120" show-overflow-tooltip></el-table-column>
      </el-table>
    </el-dialog>
  </div>

  <script type="module">
    import { exportExcelData, getParams, fetchSuggestion } from '../Scripts/hooks/useCommonMethod.js'
    import { prevWeek, thisWeek, nextWeek, prevMonth, thisMonth, nextMonth } from '../Scripts/hooks/useDateShortCut.js'
    import { getFactoryInfo, getWorkcenterList } from '../Scripts/hooks/fetchAPI.js';
    import { splitDate } from '../Scripts/hooks/format.js'
    import Vue2ReportHeader from '../Scripts/components/Vue2ReportHeader.js'
    const app = new Vue({
      el: '#app',
      components: { Vue2ReportHeader },
      data: {
        splitDate,
        total: 0,
        loading: false,
        loadingText: '数据加载中...',
        thisweek: '',
        queryInfo: {
          factoryid: '',
          factoryname: '',
          selectdate: '',//筛选时间
          workcenterid: '',//主制工区
          ordertype: '',//订单类型
          plantype: '',//计划类型
          isdelay: '',//是否超期
          isskip: '',//是否跳序
          status: '',//完工状态
          productname: '',//零件号
          priority: '',//重要程度
          risklevel: '',//风险等级
          worktimerate: [0, 100],
          currentPage: 1,//当前页
          pageSize: 12//每页显示条数
        },
        loadingConfig: { text: '数据查询中...', effect: 'whirling', maskColor: 'transparent', textColor: '#fff' },
        rules: { selectdate: [{ required: true, message: '筛选时间不能为空', trigger: 'change' }] },
        dataList: [],
        workcenterList: [],
        pickerOptions: { shortcuts: [prevMonth, thisMonth] },
        // 子零件批次
        childContainerDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 子零件批次工序
        childContainerSpecDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 缺件明细
        missingPartDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 未完成子零件批次信息
        notFinishedChildContainerDetail: { dialogVisiable: false, dataList: [], title: '' },
        // 跳序信息
        skipStepDetail: { dialogVisiable: false, dataList: [], title: '' }
      },
      methods: {
        // 查询件号
        searchProductAsync(value, callback) {
          fetchSuggestion({ actionName: 'getProductnameAsync', name: 'productname', value, callback, triggerLength: 2 })
        },
        async getData() {
          this.$refs['queryInfoRef'].validate(async (valid) => {
            if (!valid) { return this.$message.error('必填项不能为空'); }
            this.loading = true
            this.loadingText = '数据加载中...'
            const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV3.ashx?action=getData', {
              type: 'getData',
              ...this.queryInfo
            })
            this.loading = false;
            if (meta.status === 500) { return this.$message.error(meta.msg); }
            this.dataList = data;
            this.total = total;
          })
        },
        // 查看子零件批次各工序
        async showChildContainerSpec(row) {
          const { containerid, containername } = row;
          this.childContainerSpecDetail.title = `【${containername}】各工序派报检明细`;
          this.childContainerSpecDetail.dialogVisiable = true;
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV3.ashx?action=getChildContainerSpec', {
            type: 'getChildContainerSpec',
            containerid
          })
          this.loading = false;
          if (meta.status === 500) { return this.$message.error(meta.msg); }
          this.childContainerSpecDetail.dataList = data;
        },
        // 子零件批次
        async showChildContainer(row) {
          const { containerid, containername } = row;
          this.childContainerDetail.title = `【${containername}】明细`;
          this.childContainerDetail.dialogVisiable = true;
          this.loading = true;
          this.loadingText = '数据加载中...';
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV3.ashx?action=getChildContainer', {
            type: 'getChildContainer',
            containerid
          })
          this.loading = false;
          if (meta.status === 500) {
            return this.$message.error(meta.msg)
          }
          this.childContainerDetail.dataList = data;
        },
        // 未完成子零件
        async getNotFinishedChildContainer(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.notFinishedChildContainerDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV3.ashx?action=getNotFinishedChildContainer', {
            type: 'getNotFinishedChildContainer',
            containername
          })
          this.loading = false;
          if (meta.status === 500) {
            return this.$message.error(meta.msg)
          }
          this.notFinishedChildContainerDetail.title = `【${containername}】未完成子零件批次信息`;
          this.notFinishedChildContainerDetail.dataList = data;
        },
        // 查询缺件
        async getMissingPart(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.missingPartDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV3.ashx?action=getMissingPart', {
            type: 'getMissingPart',
            containername
          })
          this.loading = false;
          if (meta.status === 500) {
            return this.$message.error(meta.msg)
          }
          this.missingPartDetail.title = `【${containername}】缺件明细`;
          this.missingPartDetail.dataList = data;
        },
        // 查询跳序信息(根据顶层批次号)
        async getSkipStepInfo(row) {
          const { containername } = row;
          this.loading = true;
          this.loadingText = '数据加载中...';
          this.skipStepDetail.dialogVisiable = true;
          const { data: { data, meta, total } } = await axios.post('../handler/board/GZTaskDashBoardV3.ashx?action=getSkipStepInfo', {
            type: 'getSkipStepInfo',
            containername,
            factoryname: this.queryInfo.factoryname
          })
          this.loading = false;
          if (meta.status === 500) {
            return this.$message.error(meta.msg)
          }
          this.skipStepDetail.title = `【${containername}】未完工工序信息`;
          this.skipStepDetail.dataList = data;
        },
        // 导出
        exportDetail() {
          const config = {
            url: '../handler/board/GZTaskDashBoardV3.ashx?action=exportExcel',
            data: { type: 'exportExcel', ...this.queryInfo, title: `${this.queryInfo.factoryname}生产计划报表导出` }
          }
          exportExcelData(config, this);
        },
        handleCurrentChange(newPage) {
          this.queryInfo.currentPage = newPage;
          this.getData();
        },
        handleSizeChange(pageSize) {
          this.queryInfo.pageSize = pageSize;
          this.getData();
        }
      },
      async mounted() {
        const startOfThisMonth = dayjs().startOf('month').format('YYYY-MM-DD');
        const endOfThisMonth = dayjs().endOf('month').format('YYYY-MM-DD');
        const startOfThisWeek = dayjs().startOf('week').format('YYYY-MM-DD');
        const endOfThisWeek = dayjs().endOf('week').format('YYYY-MM-DD');
        this.queryInfo.selectdate = [startOfThisMonth, endOfThisMonth];
        this.thisweek = [startOfThisWeek, endOfThisWeek];

        const factoryInfo = await getFactoryInfo({ factoryid: Decrypt(getParams('factoryid')), isMapping: '是' });//查询当前分厂信息
        const { factoryid, factoryname } = factoryInfo[0];
        this.queryInfo.factoryname = factoryname;
        this.queryInfo.factoryid = factoryid;
        document.title = factoryname + '生产计划报表';

        this.workcenterList = await getWorkcenterList({
          factoryid: Decrypt(getParams('factoryid')),
          isMapping: '是',
          workcentertype: '是'
        });
        this.getData();
      },
      computed: {
        worktimeratelable() { return `${this.queryInfo.worktimerate[0]}% ~ ${this.queryInfo.worktimerate[1]}%` }
      },
      watch: {
        queryInfo: { handler() { this.queryInfo.currentPage = 1 }, deep: true }
      }
    })
  </script>
</body>

</html>